package com.example.pro1.controller.zhao;


import com.google.gson.Gson;
import com.example.pro1.config.zhao.WxAppletsConfig;
import com.example.pro1.service.zhao.wxapplets.WxAppletsLogin;
import com.example.pro1.valu.R;
import com.example.pro1.valu.Standard;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@CrossOrigin//开放前端跨域访问
@Api(tags = "微信小程序")
@RestController
@RequestMapping("/api/order-info")
public class WxAppletsController {


    @Resource
    private WxAppletsConfig wxAppletsConfig;
    @Resource
    private WxAppletsLogin wxAppletsLogin;
    @GetMapping("/login/oid/{code}")
    public Standard login(@PathVariable String code) throws Exception {
        String r=wxAppletsLogin.login(code);
        Gson gson=new Gson();
        Map<String,Object> map=gson.fromJson(r,Map.class);
        return R.ok().setData(map);
    }

}
